package com.aspose.cells;

import java.util.ArrayList;

public class Title extends ChartFrame {
   Axis v;
   private int l = 1;
   private int m = 1;
   private int n;
   private ArrayList o;
   String w;
   private boolean p;
   private boolean q;
   private boolean r = false;
   private boolean s = false;
   private int t = 0;
   byte[] x;
   private boolean u = false;
   boolean y = false;
   private boolean z = true;

   Title(Chart chart) {
      super(chart);
      this.b(3);
   }

   Title(Axis axis) {
      super(axis.a());
      this.v = axis;
      this.b(4);
   }

   public int getTextHorizontalAlignment() {
      return this.l;
   }

   public void setTextHorizontalAlignment(int value) {
      switch(value) {
      case 1:
      case 3:
      case 6:
      case 7:
      case 8:
         this.l = value;
      case 2:
      case 4:
      case 5:
      default:
      }
   }

   public int getTextVerticalAlignment() {
      return this.m;
   }

   public void setTextVerticalAlignment(int value) {
      switch(value) {
      case 0:
      case 1:
      case 3:
      case 6:
      case 9:
         this.m = value;
      case 2:
      case 4:
      case 5:
      case 7:
      case 8:
      default:
      }
   }

   public int getRotationAngle() {
      return this.n;
   }

   public void setRotationAngle(int value) {
      if ((value < -90 || value > 90) && value != 255) {
         throw new IllegalArgumentException("Invalid rotation : it must be between -90 and 90 or equal 255");
      } else {
         this.n = value;
      }
   }

   /** @deprecated */
   public int getRotation() {
      return this.n;
   }

   /** @deprecated */
   public void setRotation(int value) {
      this.setRotationAngle(value);
   }

   ArrayList D() {
      return this.o;
   }

   void a(ArrayList var1) {
      this.o = var1;
   }

   public void removeCharacters() {
      this.o = null;
   }

   public FontSetting characters(int startIndex, int length) {
      if (this.o == null) {
         this.o = new ArrayList();
      }

      FontSetting var3;
      for(int var4 = 0; var4 < this.o.size(); ++var4) {
         var3 = (FontSetting)this.o.get(var4);
         if (var3.getLength() == length && var3.getStartIndex() == startIndex) {
            return var3;
         }
      }

      var3 = new FontSetting(startIndex, length, this.getChart().j(), true);
      com.aspose.cells.b.a.a.ze.a(this.o, (Object)var3);
      return var3;
   }

   public String getText() {
      if (this.x != null) {
         Chart var1 = this.getChart();
         zik var2 = zin.a(var1.j(), var1.getWorksheet());
         var2.a(this.x);
         this.w = var2.i();
      }

      return this.w;
   }

   public void setText(String value) {
      if (value != null && value.length() > 255) {
         throw new CellsException(10, "The text length of the chart title should be less than 256.");
      } else {
         this.w = value;
         this.p = false;
         if (value == null) {
            this.q = true;
         } else {
            this.q = false;
         }

         this.o = null;
         this.x = null;
      }
   }

   void b(String var1) {
      this.w = var1;
      this.p = false;
      if (var1 == null) {
         this.q = true;
      }

   }

   public boolean isVisible() {
      if (this.q) {
         return false;
      } else {
         String var1 = this.getText();
         return this.isAutoText() || var1 != null && !"".equals(var1);
      }
   }

   public void setVisible(boolean value) {
      if (value) {
         this.q = false;
         String var2 = this.getText();
         if (var2 == null || "".equals(var2)) {
            this.p = true;
         }
      } else {
         this.setText((String)null);
      }

   }

   static void a(Chart var0, Font var1, boolean var2) {
      Font var3 = var0.getChartArea().getFont();
      var1.c(var3);
      var1.l();
      if (var2) {
         if (!var0.getChartArea().getFont().f(17)) {
            var1.a(true);
         }

         if (var0.getChartArea().getFont().f(12)) {
            var1.a(var0.getChartArea().getFont().getDoubleSize() * 1.2D);
         } else {
            switch(var0.getStyle()) {
            case -1:
            case 2:
               var1.a(18.0D);
               break;
            case 41:
            case 42:
            case 43:
            case 44:
            case 45:
            case 46:
            case 47:
            case 48:
               var1.a(18.0D);
               var1.b.a(2, Color.getWhite().toArgb());
               break;
            default:
               var1.a(18.0D);
            }
         }
      } else {
         if (!var0.getChartArea().getFont().f(17)) {
            var1.a(true);
         }

         if (var0.getChartArea().getFont().f(12)) {
            var1.a(var0.getChartArea().getFont().getDoubleSize());
         }

         switch(var0.getStyle()) {
         case 41:
         case 42:
         case 43:
         case 44:
         case 45:
         case 46:
         case 47:
         case 48:
            var1.b.a(2, Color.getWhite().toArgb());
         }
      }

   }

   public boolean isAutoText() {
      return this.p;
   }

   public void setAutoText(boolean value) {
      this.p = value;
   }

   boolean E() {
      return this.q;
   }

   void k(boolean var1) {
      this.q = var1;
   }

   public int getX() {
      return this.m();
   }

   public void setX(int value) {
      this.e(value);
      this.a(true);
      this.h(false);
      this.e(false);
      this.i(true);
   }

   public int getY() {
      return this.n();
   }

   public void setY(int value) {
      this.f(value);
      this.b(true);
      this.h(false);
      this.f(false);
      this.i(true);
   }

   boolean F() {
      return this.r;
   }

   void l(boolean var1) {
      this.r = var1;
   }

   boolean G() {
      return this.s;
   }

   void m(boolean var1) {
      this.s = var1;
   }

   public int getTextDirection() {
      return this.t;
   }

   public void setTextDirection(int value) {
      this.t = value;
   }

   void a(Title var1, CopyOptions var2) {
      super.a(var1, var2);
      this.k(var1.E());
      this.n = var1.n;
      this.l = var1.l;
      this.m = var1.m;
      this.r = var1.r;
      this.t = var1.t;
      this.w = var1.w;
      String var3 = var1.getLinkedSource();
      if (var1.D() != null && var1.D().size() > 0) {
         this.o = new ArrayList();

         for(int var4 = 0; var4 < var1.o.size(); ++var4) {
            FontSetting var5 = (FontSetting)var1.o.get(var4);
            FontSetting var6 = new FontSetting(var5.getStartIndex(), var5.getLength(), this.getChart().j(), true);
            var6.getFont().c(var5.getFont());
            com.aspose.cells.b.a.a.ze.a(this.o, (Object)var6);
         }
      }

      if (var1.x != null) {
         Worksheet var8 = var1.getChart().getWorksheet();
         Worksheet var9 = this.getChart().getWorksheet();
         zik var10 = zin.a(var8.c(), var8);
         var10.a((byte[])var1.x);
         zik var7 = zin.a(var9.c(), var9);
         var7.a(var10, var8.m(), var2);
         this.x = var7.f();
      }

      this.p = var1.p;
      this.z = var1.z;
   }

   boolean H() {
      return this.getBorder().isVisible() || this.getArea().getFormatting() != 1;
   }

   public String getLinkedSource() {
      if (this.x == null) {
         return null;
      } else {
         Chart var1 = this.getChart();
         zik var2 = zin.a(var1.j(), var1.getWorksheet());
         var2.a(this.x);
         var2.a(2);
         return var2.h();
      }
   }

   public void setLinkedSource(String value) {
      Chart var2 = this.getChart();
      zik var3 = zin.a(var2.j(), var2.getWorksheet(), value);
      this.x = var3.f();
      this.w = var3.i();
   }

   void c(String var1) {
      Chart var2 = this.getChart();

      try {
         zik var3 = zin.a(var2.j(), var2.getWorksheet(), var1);
         this.x = var3.f();
         this.w = var3.i();
      } catch (Exception var4) {
         com.aspose.cells.a.c.zl.b(var4);
      }

   }

   public boolean getOverLay() {
      return this.u;
   }

   public void setOverLay(boolean value) {
      this.u = value;
      this.y = true;
   }

   public FontSetting[] getCharacters() {
      if (this.o == null) {
         return new FontSetting[0];
      } else {
         FontSetting[] var1 = new FontSetting[this.o.size()];

         for(int var2 = 0; var2 < this.o.size(); ++var2) {
            FontSetting var3 = (FontSetting)this.o.get(var2);
            var1[var2] = var3;
         }

         return var1;
      }
   }

   boolean I() {
      return this.z;
   }

   void n(boolean var1) {
      this.z = var1;
   }
}
